package com.hospital.handler;

import com.hospital.vo.ResponseVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author yuhuan
 * @Date 2022/4/1
 */
@RestControllerAdvice
@Slf4j
public class ErrorAdviceHandler {

    @ExceptionHandler(RuntimeException.class)
    public ResponseVO noteExceptionHandler(RuntimeException re) {
        log.error(">>> 检测到异常状态！异常类型为：" + re);
        return ResponseVO.buildSuccessInstance(ResponseVO.RESP_ERROR);
    }
}
